home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-19 | 45.6 KB | 1,298 lines |
- Chapter 7
- of the
- Turbo Pascal Reference
-
- The Turbo Vision Reference
- (continued)
-
- This chapter is part of the Turbo Pascal Reference electronic freeware book (C)
- Copyright 1992 by Ed Mitchell. This freeware book contains supplementary
- material to Borland Pascal Developer's Guide, published by Que Corporation,
- 1992. However, Que Corporation has no affiliation with nor responsibility for
- the content of this free book. Please see Chapter 1 of the Turbo Pascal
- Reference for important information about your right to distribute and use this
- material freely. If you find this material of use, I would appreciate your
- purchase of one my books, such as the Borland Pascal Developer's Guide or
- Secrets of the Borland C++ Masters, Sams Books, 1992. Thank you.
-
- For additional information on using Turbo Vision, including a detailed
- tutorial, please see Chapters 11 through 16 of the Borland Pascal Developer's
- Guide.
-
-
- HistoryAdd procedure
- ------------------------------------------------------------
- Declaration:
- procedure HistoryAdd
- ( Id: Byte; var Str: String);
-
- Unit: HistList
-
- Purpose:
- This is an internal routine used by the THistory and related objects to
- add a string Str to the history list identified by the Id number.
-
-
- HistoryBlock variable
- ------------------------------------------------------------
- Declaration:
- HistoryBlock: Pointer = nil;
-
- Unit: HistList
-
- Purpose:
- The THistory object allocates a block of memory from the heap in order to
- store the history list. HistoryBlock is set to point to this memory
- block.
-
-
- HistoryCount function
- ------------------------------------------------------------
- Declaration:
- function HistoryCount(Id: Byte): Word;
-
- Unit: HistList
-
- Purpose:
- The THistory history list system, and the associated history list memory
- manager (See HistoryAdd, HistoryBlock, HistorySize, HistoryStr,
- HistoryUsed) can manage multiple memory history lists. The HistoryCount
- function calculates and returns the number of items stored in the history
- list selected by the Id value.
-
-
- HistorySize variable
- ------------------------------------------------------------
- Declaration:
- HistorySize: Word = 1024;
-
- Unit:
- HistList
-
- Purpose:
- At program initialization, TApplication.Init calls the InitHistory
- procedure to allocate history list memory space. The default allocation
- is determined by the value stored in HistorySize. To change this value,
- set HistorySize to a new size, specified in bytes, before calling
- TApplication.Init.
-
-
- HistoryStr function
- ------------------------------------------------------------
- Declaration:
- function HistoryStr(Id: Byte; Index: Integer): String;
-
- Unit: HistList
-
- Purpose:
- Looks into the history list specified by Id, and returns the contents of
- the Index'th string in the list.
-
-
- HistoryUsed variable
- ------------------------------------------------------------
- Declaration:
- HistoryUsed: Word = 0;
-
- Unit: HistList
-
- Purpose:
- This is an internal value used by the history list routines.
-
-
- InitHistory procedure
- ------------------------------------------------------------
- Declaration:
- procedure InitHistory;
-
- Unit: HistList
-
- Purpose:
- TApplication.Init calls this routine to initialize the history list
- management system. Also see HistorySize and THistory.
-
-
- InputBox function
- ------------------------------------------------------------
- Declaration:
- function InputBox (Title : String;
- ALabel : String;
- var S : String;
- Limit : Byte ) : Word;
-
- Unit: MsgBox, source code in \TP\TVDEMOS\MSGBOX.PAS
-
- Purpose:
- InputBox is not described in the Borland documentation but is contained in
- the file MSGBOX.PAS (and MSGBOX.TPU) contained in the \TP\TVDEMOS directory (TP
- 6.0).
- InputBox displays a simple dialog with a single label and input field,
- plus Okay and Cancel buttons. The Title parameter becomes the dialog box
- title, and the input field is given ALabel as a prompt line. The input field
- is set to Limit bytes in length. InputBox returns eithe cmOkay or cmCancel.
- See Listing DMSGBOX3.PAS for an example of using the message box.
- 1 { DMSGBOX3.PAS
- 2 Demonstrates use of InputBox
- 3 }
- 4 procedure TShell.DemoInputBox;
- 5 var
- 6 Control : Word;
- 7 begin
- 8 Control := InputBox('The Title', 'Enter some text:',
- FileName, 30);
- 9 end; { TShell.DemoInputBox }
-
- See: MessageBox, InputBoxRect, MessageBoxRect for related functions.
-
-
-
- InputBoxRect function
- ------------------------------------------------------------
- Declaration:
- function InputBox (var Bounds : TRect;
- Title : String;
- ALabel : String;
- var S : String;
- Limit : Byte ) : Word;
-
- Unit: MsgBox, source code in \TP\TVDEMOS\MSGBOX.PAS
-
- Purpose:
- InputBoxRect is not described in the Borland documentation but is
- contained in the file MSGBOX.PAS (and MSGBOX.TPU) contained in the \TP\TVDEMOS
- directory (TP 6.0).
- InputBoxRect is identical to InputBox except that you can specify a
- bounding rectangle in order to position and size the input box to specific
- coordinates. See also MessageBoxRect.
-
- See: InputBox, MessageBox, MessageBoxRect
-
-
- InitEvents procedure
- ------------------------------------------------------------
- Declaration:
- procedure InitEvents;
-
- Unit: Drivers;
-
- Purpose:
- This internal procedure initializes Turbo Vision's event manager, and
- initializes and displays the mouse, if installed. InitEvents is
- automatically called by TApplication.Init, and is terminated by calling
- its corresponding DoneEvent procedure.
-
-
- InitMemory procedure
- ------------------------------------------------------------
- Declaration:
- procedure InitMemory;
-
- Unit: Memory
-
- Purpose:
- This internal procedure initialize's Turbo Vision's memory management
- system and is automatically called by TApplication.Init. InitMemory is
- terminated by calling its corresponding DoneMemory.
-
-
- InitSysError procedure
- ------------------------------------------------------------
- Declaration:
- procedure InitSysError;
-
- Unit: Drivers
-
- Purpose:
- This internal procedure, called by TApplication.Init, initializes system
- error trapping by redirecting the interrupt vectors 09H, 1BH, 21H, 23H,
- and 24H and clearing DOS's Ctrl-Break state. System error trapping is
- terminated by calling the corresponding DoneSysError routine.
-
-
- InitVideo procedure
- ------------------------------------------------------------
- Declaration:
- procedure InitVideo;
-
- Unit: Drivers
-
- Purpose:
- This internal procedure, called by TApplication.Init, initialize's Turbo
- Vision's video display manager and switches the display to the mode
- specified in the ScreenMode variable. InitVideo initializes the variables
- ScreenWidth, ScreenHeight, HiResScreen, CheckSnow, ScreenBuffer and
- CursorLines.
-
-
- kbXXXX constants
- ------------------------------------------------------------
- Keyboard constants
- The kbXXXX constants are divided into two groups: a small group for
- detecting keyboard shift states, and a large group as equates for the
- non-standard keystrokes such as function and Alt keys.
-
- Keyboard Shift State constants
- Constant Value Usage
-
- kbRightShift $0001 Bit set if the right shift key down
- kbLeftShift $0002 Bit set if the left shift key down
- kbCtrlShift $0004 Bit set if the Ctrl key is down
- kbAltShift $0008 Bit set if the Alt key is down
- kbScrollState $0010 Bit set if the Scroll Lock is down
- kbNumState $0020 Bit set if the Num Lock is down
- kbCapsState $0040 Bit set if the Caps Lock down
- kbInsState $0080 Bit set if keyboard is in Ins Lock state
-
- The keyboard shift state constants are used as a bit mask to test a
- location in low memory at $40:$17 for the status of various keyboard keys, such
- as the Ctrl or Shift key. For example, to see if the keyboard is producing
- shifted characters, declare an absolute variable at $40:$17 and test the bits
- like this:
- var
- KeyboardShifts : Byte absolute $40:$17;
- ...
- if (KeyboardShifts and
- (kbRightShift or kbLeftShift or kbCapsState) ) <> 0
-
- Keyboard Scancode Constants
- Use these constants to check for specific keystroke values in the
- TEvent.KeyCode field. For example,
- if Event.KeyCode = kbPgDn then
- { handle page down function }
- ...
-
- Alt-Ch key code constants
-
- Constant Value Constant Value
-
- kbAltA $1E00 kbAltN $3100
- kbAltB $3000 kbAltO $1800
- kbAltC $2E00 kbAltP $1900
- kbAltD $2000 kbAltQ $1000
- kbAltE $1200 kbAltR $1300
- kbAltF $2100 kbAltS $1F00
- kbAltG $2200 kbAltT $1400
- kbAltH $2300 kbAltU $1600
- kbAltI $1700 kbAltV $2F00
- kbAltJ $2400 kbAltW $1100
- kbAltK $2500 kbAltX $2D00
- kbAltL $2600 kbAltY $1500
- kbAltM $3200 kbAltZ $2C00
-
-
- Ctrl and special key code constants
- Constant Value Constant Value
-
- kbAltEqual $8300 kbEnd $4F00
- kbAltMinus $8200 kbEnter $1C0D
- kbAltSpace $0200 kbEsc $011B
- kbBack $0E08 kbGrayMinus $4A2D *
- kbCtrlBack $0E7F kbHome $4700
- kbCtrlDel $0600 kbIns $5200
- kbCtrlEnd $7500 kbLeft $4B00 *
- kbCtrlEnter $1C0A kbNoKey $0000
- kbCtrlHome $7700 kbPgDn $5100
- kbCtrlIns $0400 kbPgUp $4900
- kbCtrlLeft $7300 kbGrayPlus $4E2B
- kbCtrlPgDn $7600 kbRight $4D00 *
- kbCtrlPgUp $8400 kbShiftDel $0700
- kbCtrlPrtSc $7200 kbShiftIns $0500
- kbCtrlRight $7400 kbShiftTab $0F00
- kbDel $5300 kbTab $0F09
- kbDown $5000 kbUp $4800
-
- [*] kbGrayMinus and kbGrayPlus are the - and + keys on the numeric keypad.
- kbLeft and kbRight are the arrow keys.
-
- Alt-number key code constants
- Constant Value Constant Value
- kbAlt1 $7800 kbAlt6 $7D00
- kbAlt2 $7900 kbAlt7 $7E00
- kbAlt3 $7A00 kbAlt8 $7F00
- kbAlt4 $7B00 kbAlt9 $8000
- kbAlt5 $7C00 kbAlt0 $8100
-
- Function key code constants
- Constant Value Constant Value
- kbF1 $3B00 kbF6 $4000
- kbF2 $3C00 kbF7 $4100
- kbF3 $3D00 kbF8 $4200
- kbF4 $3E00 kbF9 $4300
- kbF5 $3F00 kbF10 $4400
-
- Shift-function key code constants
- Constant Value Constant Value
- kbShiftF1 $5400 kbShiftF6 $5900
- kbShiftF2 $5500 kbShiftF7 $5A00
- kbShiftF3 $5600 kbShiftF8 $5B00
- kbShiftF4 $5700 kbShiftF9 $5C00
- kbShiftF5 $5800 kbShiftF10 $5D00
-
- Ctrl-function key code constants
- Constant Value Constant Value
- kbCtrlF1 $5E00 kbCtrlF6 $6300
- kbCtrlF2 $5F00 kbCtrlF7 $6400
- kbCtrlF3 $6000 kbCtrlF8 $6500
- kbCtrlF4 $6100 kbCtrlF9 $6600
- kbCtrlF5 $6200 kbCtrlF10 $6700
-
- Alt-function key codes
- Constant Value Constant Value
- kbAltF1 $6800 kbAltF6 $6D00
- kbAltF2 $6900 kbAltF7 $6E00
- kbAltF3 $6A00 kbAltF8 $6F00
- kbAltF4 $6B00 kbAltF9 $7000
- kbAltF5 $6C00 kbAltF10 $7100
-
-
-
- LongDiv function
- ------------------------------------------------------------
- Declaration:
- function LongDiv( X:Longint; Y:Integer):Integer;
-
- Unit: Objects
-
- Purpose:
- LongDiv is an inline assembly function providing a fast implementation of
- X divided by Y.
-
-
- LongMul function
- ------------------------------------------------------------
-
- Declaration:
- function LongDiv( X:Integer; Y:Integer):LongInt;
-
- Unit: Objects
-
- Purpose:
- LongMul is an inline assembly function providing a fast implementation of
- X multiplied by Y.
-
-
- LongRec type
- ------------------------------------------------------------
- Declaration:
- type LongRec = record
- Lo, Hi: Word;
- end;
- Unit: Objects
-
- Purpose: Double word record type.
-
-
- LowMemory function
- ------------------------------------------------------------
- Declaration:
- function LowMemory : Boolean;
- Unit: Memory
- Purpose:
- LowMemory returns TRUE if a memory allocation used a portion of the memory
- safety pool, otherwise LowMemory returns FALSE. Use of the memory safety
- pool is described in Chapter 19.
-
-
- LowMemSize variable
- ------------------------------------------------------------
- Declaration:
- LowMemSize: Word = 4096 div 16;
-
- Unit: Memory
-
- Purpose:
- Specifies the size of the memory safety pool, in 16-byte paragraphs. The
- default is 4K bytes but it may be set to larger values, as needed for your
- application. See Chapter 19 for more information on using LowMemory and
- LowMemSize and detecting low or out of memory conditions in your Turbo
- Vision applications.
-
-
- MaxBufMem variable
- ------------------------------------------------------------
- Declaration:
- MaxBufMem : Word = 65536 div 16;
-
- Unit: Memory
-
- Purpose:
- Specifies the maximum memory size, in 16- byte pages, available for cache
- buffers. See also GetBufMem and FreeBufMem and the description at the end
- of Chapter 13.
-
-
- MaxCollectionSize variable
- ------------------------------------------------------------
- Declaration:
- MaxCollectionSize = 65520 div SizeOf(Pointer);
-
- Unit: Objects
-
- Purpose:
- MaxCollectionSize sets the maximum number of elements that can be put into
- a collection (which is equal to the maximum number of pointers that can
- fit into a single data segment).
-
-
- MaxViewWidth constant
- ------------------------------------------------------------
- Declaration:
- MaxViewWidth = 132;
-
- Unit: Views
-
- Purpose:
- Determines the maximum width of a view.
-
-
- mbXXXX constant
- ------------------------------------------------------------
- Mouse Button constants
-
- Unit: Drivers
-
- Purpose:
- The mbXXXX constants are used to test the Event.Buttonsfield of a TEvent
- record or the MouseButtons variable to determine if the left or right
- button was pressed.
-
- Constant Value Usage
- mbLeftButton $01 Value if left button was pressed.
- mbRightButton $02 Value if right button was presseed.
-
- See: MouseButtons, TEvent
-
-
- MemAlloc function
- ------------------------------------------------------------
- Declaration:
- function MemAlloc( Size: Word): Pointer;
- Unit: Memory
- Purpose:
- Like the System library routine GetMem, MemAlloc attempts to allocate a
- block of size bytes from the memory heap, returning a pointer to the allocated
- memory block However, unlike GetMem, MemAlloc will not allow an allocation
- from the low memory safety pool. Instead, MemAlloc will generate a Heap
- Overflow error if it needs to access the safety pool.
- Note that the Borland Object Reference description of this routine is
- incorrect: Borland's manual states that MemAlloc returns Nil if it runs out of
- memory. That is not the default operation and will only operate that way if
- you set the HeapError variable to point to a HeapFunc that returns a value of
- 1. Listing MEMALLOC.PAS illustrates how to do this.
- 1 { MEMALLOC.PAS
- 2 Demonstrates use of the Turbo Vision MemAlloc function.
- 3 }
- 4 Program DemoMemAlloc;
- 5 uses
- 6 Memory;
- 7 label 99;
- 8 var
- 9 APointer : Pointer;
- 10 I : Integer;
- 11
- 12 function HeapFunc(Size : Word): Integer; far;
- 13 { Returns 1 = force memory manager to return NIL on out of memory
- 14 set to alternate values as shown:
- 15 0 = force a Heap Overflow error
- 16 2 = tells the memory manger to try again (for instance,
- 17 you might dispose of some items in this routine, thereby
- 18 freeing up some memory)
- 19 }
- 20 begin
- 21
- 22 HeapFunc := 1;
- 23
- 24 end;
- 25
- 26
- 27 begin
- 28 { Initialize the Heap Overflow checker }
- 29 HeapError := @HeapFunc;
- 30
- 31 { Allocate some blocks of memory until running out of free space.
- 32 You may have to use a value higher than 20 or a larger block size }
- 33 for i:=1 to 20 do
- 34 begin
- 35 APointer := MemAlloc(20000);
- 36
- 37 writeln(longint(Apointer));
- 38 if APointer = NIL then
- 39 begin
- 40 writeln('OUT OF MEMORY');
- 41 Goto 99;
- 42 end;
- 43
- 44 Write('Press Enter to continue');
- 45 readln;
- 46 end;
- 47
- 48 99:
- 49 Write('Program completed. Press Enter to continue');
- 50 Readln;
- 51
- 52 end.
-
- Use FreeMem to dispose of the allocated block.
- Related items: New, GetMem, Dispose, FreeMem, MemAllocSeg
-
-
-
- MemAllocSeg function
- ------------------------------------------------------------
- Declaration:
- function MemAllocSeg( Size : Word): Pointer;
- Unit: Memory
- Purpose:
- MemAllocSeg is identical to MemAlloc except that MemAllocSeg forces the
- offset value of the segment:offset pointer it returns, to be zero. This
- insures that the memory allocation is always made on an even 16-byte or
- segment page boundary.
-
-
- MenuBar variable
- ------------------------------------------------------------
- Declaration:
- MenuBar: PMenuView = nil;
-
- Unit: App
- Purpose:
- MenuBar is initialized by TProgram.InitMenuBar (via
- TApplication.InitMenuBar, which you override in your program when
- initializing the pulldown menus) to point to your application's menu bar.
- The default value of Nil indicates that no menu bar is defined for the
- application. See the examples in the "Turbo Vision Tutorial", Chapter 11
- in the Borland Pascal Developer's Guide.
-
-
- Message function
- ------------------------------------------------------------
- Declaration: function Message( Receiver: PView;
- What, Command : Word;
- InfoPtr : Pointer): Pointer;
- Unit: Views;
- Purpose:
- Use Message to send messages between views. Message creates an evCommand
- event record using the parameters What, Command and InfoPtr and attempts
- to invoke Receiver^.HandleEvent to process the event. If
- Receiver^.HandleEvent successfully handles the event then the Message
- returns Event.InfoPtr from the processed message (which is a pointer to
- the object that handled the message). Otherwise, if the event was not
- handled, Message returns NIL.
- When using Message, the InfoPtr parameter may be used for most
- any purpose. For example, to pass a block of data to the recepient, set
- this parameter to point to a data record. If you wish to let the
- recepient of the message know who sent the message, set InfoPtr to @Self.
- The message facility is used for many purposes. One example is
- a list box and a vertical scroll bar. Whenever the scroller position is
- adjusted (using the mouse or keyboard controls), the scroller sends a
- message informing the world that it has changed,
- Message( TopView, evBroadcast,
- cmScrollBarChanged, @Self );
- where TopView is a TView function returning a pointer to the current modal
- view (hence, the view that owns the scrollbar), and cmScrollBarChanged is
- a standard message broadcast to the rest of the views informing the world
- that it has changed. TopView^.HandleEvent looks at the cmScrollBarChanged
- message and passes it along to its subviews. Eventually, the list box
- view receives and processes the message at its HandleEvent method, causing
- the listbox cursor to move up or down, or for the contents of the list box
- to be redrawn.
-
-
- MessageBox function
- ------------------------------------------------------------
- Declaration: function MessageBox( Msg: String;
- Params: Pointer;
- AOptions : Word) : Word;
-
- Unit: MsgBox, source in file \TP\TVDEMOS\MSGBOX.PAS
-
- Purpose:
- MessageBox is not described in the Borland documentation but is provided
- in the file MSGBOX.PAS in the \TP\TVDEMOS directory (TP 6.0).
- MessageBox displays a string within a dialog box, inserting optional
- Params parameters, as desired, and displays optional Okay, Cancel, Yes or No
- buttons depending upon the settings of the AOptions parameter. This function
- is useful for displaying error and warning messages.
- The Msg string and the Params parameter are both passed to the FormatStr
- procedure for formatting. Because of this, you can insert variable parameters
- into the Msg string (see the description of FormatStr for more information on
- the type of formatting that may be performed).
- For example, if a problem occurs renaming a file, you might display an
- error message using the sample code shown in Listing DMSGBOX2.PAS.
- 1 { DMSGBOX2.PAS
- 2 Demonstrates use of the MessageBox function
- 3 }
- 4 procedure TShell.DemoMessageBox;
- 5
- 6 var
- 7 Control : Word;
- 8 ErrMsg : Array [0..0] of Longint;
- 9 FileName: String;
- 10
- 11 begin
- 12
- 13 FileName := 'SAMPLE.TXT';
- 14 ErrMsg[0] := Longint(@FileName);
- 15 Control := MessageBox ('Problem renaming %s', @ErrMsg,
- 16 mfError or mfOKButton or mfCancelButton );
- 17
- 18 end; { TShell.DemoMessageBox }
- 19
- 20
-
- The ErrMsg array is set to point to the filename parameter that will be
- inserted into the message string (as per FormatStr usage).
- The AOptions values select the type of message box to display and the
- type of buttons to display in the message box. Select only one Message box
- type, and or it with the button types shown in the Button flags table.
- The MessageBox function returns either cmOkay, cmCancel, cmYes or cmNo.
-
- Table of Message Box Types
- Constant Value Usage
- mfWarning $0000 Display a warning type message box
- mfError $0001 Display an error type message box
- mfInformation $0002 Display an Information box
- mfConfirmation $0003 Display a confirmation box
-
- Table of Button flags
- Constant Value Usage
- mfYesButton $0100 Show a Yes button
- mfNoButton $0200 Show a No button
- mfOkButton $0400 Show an Okay button
- mfCancelButton $0800 Show a Cancel button
- mfYesNoCancel Show a Yes, No and a Cancel button
- mfOkCancel Show an Okay and a Cancel button
-
- IMPORTANT
- MessageBox only works within Turbo Vision applications. Do not attempt to
- use MessageBox in non-Turbo Vision applications.
- See: FormatStr, MessageBoxRect, TStaticText
-
-
-
- MessageBoxRect function
- ------------------------------------------------------------
- Declaration: function MessageBoxRect ( var R : TRect;
- Msg : String;
- Params : Pointer;
- AOptions : Word ): Word;
-
- Unit: MSGBOX, source code in \TP\TVDEMOS\MSGBOX.PAS
-
- Purpose:
- MessageBoxRect is identical to MessageBox, except that you can specify a
- specific location and size for the message box using the R parameter. For
- example,
- R.Assign (5, 5, 60, 10);
- Control := MessageBoxRect( R, 'Problem Renaming %s',
- @ErrMsg, mfError or mfCancel );
-
- See: MessageBox
-
-
- MinWinSize variable
- ------------------------------------------------------------
- Declaration: MinWinSize : TPoint = (X: 16; Y: 6);
-
- Unit: Views
-
- Purpose:
- MinWinSize sets the minimum allowed width and height for all objects
- descended from TWindow. The default is 16 characters wide and 6
- characters high (including the shadow). You can see how these values are
- used by sizing an editor window in the IDE to the minimum size.
-
-
- MouseButtons variable
- ------------------------------------------------------------
- Declaration: MouseButtons : Byte;
-
- Unit: Drivers
-
- Purpose:
- Contains the current state of the mouse buttons. See the mbXXXX constants
- for the bit settings in this variable.
-
-
- MouseEvents variable
- ------------------------------------------------------------
- Declaration:
- MouseEvents : Boolean = False;
-
- Unit: Drivers
-
- Purpose:
- The InitEvents procedure detects the prescence of a mouse, and if a mouse
- is found, sets MouseEvents to True. If no mouse is found, then
- MouseEvents is set to False and no mouse event processing occurs.
-
-
- MouseIntFlag variable
- ------------------------------------------------------------
- Declaration:
- MouseIntFlag : Byte;
-
- Unit: Drivers
-
- Purpose:
- This is an internal variable used by Turbo Vision.
-
-
- MouseReverse variable
- ------------------------------------------------------------
- Declaration:
- const MouseReverse : Boolean = FALSE;
- Unit: Drivers
- Purpose:
- When set to TRUE, this field causes the TEvent.Buttons field to reverse
- the mbLeftButton and mbRightButton flags.
-
-
- MouseWhere variable
- ------------------------------------------------------------
- Declaration:
- MouseWhere: TPoint;
- Unit: Drivers
- Purpose:
- This TPoint-typed variable is set by the mouse interrupt handler and
- contains the coordinates of the mouse in global or screen coordinates.
- Youcan convert the coordinates to view or window relative coordinates
- using the TView.MakeLocal procedure.
-
-
- MoveBuf procedure
- ------------------------------------------------------------
- Declaration: procedure MoveBuf( var Dest;
- var Source;
- Attr : Byte;
- Count : Word );
- Unit: Objects
-
- Purpose:
- MoveBuf is typically used for copying text and video attribute bytes to a
- TDrawBuffer-type array. Such an array holds character bytes in the low
- bytes of each word, and attribute values in the high bytes. MoveBuf
- copies Count bytes from Source into the low bytes of the Dest destination
- parameter, setting each high byte to the Attr byte value (or leaving the
- attribute bytes as is if Attr equals zero).
- See: MoveChar, TDrawBuffer, TView.WriteBuf and TView.WriteLine.
-
-
- MoveChar procedure
- ------------------------------------------------------------
- Declaration: procedure MoveChar( var Dest: C: Char;
- Attr: Byte;
- Count : Word);
-
- Unit: Objects
-
- Purpose:
- Similar to MoveBuf, except that this copies the single character C, Count
- number of times, into each low byte of the Dest parameter (which should be
- a TDrawBuffer type), and if Attr is non-zero, copies Attr to each high
- byte position in the array of words.
- See: MoveBuf, TDrawBuffer, TView.WriteBuf and TView.WriteLine.
-
-
- MoveCStr procedure
- ------------------------------------------------------------
- Declaration:
- procedure MoveCStr( var Dest; Str: String; Attrs: Word);
-
- Unit: Objects
-
- Purpose:
- MoveCStr copies a string to a TDrawBuffer array such that the text is
- alternately one of two different colors. MoveCStr copies the Str string
- parameter to the Dest (a TDrawBuffer array) and sets each character's
- attributes using either the low or high byte of the Attr word. Initially,
- MoveCStr uses the low byte of Attr, but upon encountering a "~" tilde
- character, MoveCStr switches to the high byte of Attr. Each tilde in the
- string causes MoveCStr to toggle to the other Attr attribute byte. MoveCStr is
- used by Turbo Vision for setting up pulldown menu strings where the hot keys
- are set off in a different color from the rest of the text. For example,
-
- NewSubMenu('~R~un', hcNoContext, NewMenu( ...
-
- You use MoveCStr like this:
-
- var
- ABuffer : TDrawBuffer;
- ...
- MoveCStr( ABuffer, 'This ~is~ some text.', $0770 );
- WriteLine( 10, 10, 18, 1, ABuffer );
-
- This sets the word 'is' to the attribute $07 and the rest of the text to $70.
- See: TDrawBuffer, MoveChar, MoveBuf, MoveStr, TView.WriteBuf and
- TView.WriteLine, see "Setting Color Palettes" in Chapter 13, "More Turbo Vision
- Features" in the Borland Pascal Developer's Guide, CColor,
- CMonochrome, CBlackWhite
-
-
- MoveStr procedure
- ------------------------------------------------------------
- Declaration:
- procedure MoveStr( var Dest; Str: String; Attr : Byte);
-
- Unit: Objects
-
- Purpose:
- MoveCStr copies the Str string parameter to the Dest (a TDrawBuffer array)
- and sets each character's attributes to the video attribute contained in
- Attr.
-
- See: TDrawBuffer, MoveChar, MoveBuf, MoveStr, TView.WriteBuf and
- TView.WriteLine, See "Setting Color Palettes" of Chapter 13 in the Borland
- Pascal Developer's Guide, CColor, CMonochrome, CBlackWhite
-
-
- NewItem function
- ------------------------------------------------------------
- Declaration: function NewItem( Name, Param : TMenuStr;
- KeyCode : Word; Command : Word;
- AHelpCtx : Word; Next : PMenuItem) :
- PMenuItem;
-
- Unit: Menus
-
- Purpose:
- NewItem is used to create new TMenuItem records during creation of
- pulldown menus and is typically nested, passing NewItem as the Next
- parameter.
-
- NewItem('~S~how Outline Numbering', 'F5', 0, cmOutlining,
- hcNocontext, NewItem( .... ) )
-
- See examples and additional descriptions in Chapters 11-12 of the Borland
- Pascal Developer's Guide.
- See: NewMenu, NewSubMenu, TApplication.InitMenuBar.
-
-
- NewLine function
- ------------------------------------------------------------
- Declaration: function NewLine ( Next: PMenuItem) : PMenuItem;
- Unit: Menus
- Purpose:
- Use NewLine to insert horizontal separator lines into pulldown menus. You
- can place NewLine anywhere that you would use a NewItem function. See
- Chapter 14, Turbo Vision Tutorial.
-
-
- NewMenu function
- ------------------------------------------------------------
- Declaration: function NewMenu (Items: PMenuItem): PMenu;
-
- Unit: Menus
-
- Purpose:
- Use NewMenu to create a new pulldown menu with a menu bar initialization
- statement. See Chapter 11, "Turbo Vision Tutorial" in the Borland Pascal
- Developer's Guide for an example of using this function.
-
-
- NewSItem function
- ------------------------------------------------------------
- Declaration:
- function NewSItem( Str : String; ANext : PSItem): PSItem;
-
- Unit: Dialogs
-
- Purpose:
- Use nested calls to NewSItem to create a linked list of strings. See
- Listing DNEWSITM.PAS for an example.
-
- Listing DNEWSITM.PAS
- 1 { DNESITM.PAS
- 2 Demonstrates use of NewSItem function
- 3 }
- 4
- 5 Program DNEWSITM;
- 6 uses
- 7 Dialogs;
- 8
- 9 var
- 10 AList : PSItem;
- 11 TempPtr : PSItem;
- 12
- 13 begin
- 14
- 15
- 16 { Create a singly-linked string list using nested
- 17 NewSItem calls.
- 18 }
- 19 AList := NewSItem('Item 1',
- 20 NewSItem('Item 2',
- 21 NewSItem('Item 3',
- 22 NewSItem('Item 4', nil))));
- 23
- 24 TempPtr := AList;
- 25 while TempPtr <> Nil do
- 26 begin
- 27 Writeln( TempPtr^.Value^ );
- 28 TempPtr := TempPtr^.Next;
- 29 end;
- 30
- 31 Write ('Press Enter to Continue');
- 32 Readln;
- 33
- 34 end.
- 35
-
- See: TSItem
-
-
- NewStatusDef function
- ------------------------------------------------------------
- Declaration: function NewStatusDef( AMin, AMax: Word;
- AItems: PStatusItem; ANext: PStatusDef)
- : PStatusDef;
-
- Unit: Menus
-
- Purpose:
- Use NewStatusDef, in conjunction with NewStatusKey to create an entire
- status line definition. See Chapter 11, "Turbo Vision Tutorial" in the
- Borland Pascal Developer's Guide.
- See: NewStatusKey, TApplication.InitStatusLine, TStatusDef
-
-
- NewStatusKey function
- ------------------------------------------------------------
- Declaration:
- function NewStatusKey( AText: String; AKeyCode: Word;
- ACommand: Word; ANext: PStatusItem)
- : PStatusItem;
-
- Unit: Menus
-
- Purpose:
- Use NewStatusKey, in conjunction with NewStatusDef to create a status line
- definition. If AText is a null string, then the status item is hidden
- (for example, the IDE uses the hidden F10 key to activate the pull down
- menus). AKeyCode is one of the kbXXXX constants and ACommand is a Turbo
- Vision or user defined cmXXXX command constant. The last parameter ANext
- is used to nest multiple calls to NewStatusKey in order to create an
- entire status line in a single statement. See Chapter 11, "Turbo Vision
- Tutorial" in the Borland Pascal Developer's Guide for details about using
- this function.
- See: NewStatusDef, TApplication.InitStatusLine, TStatusDef
-
-
- NewStr function
- ------------------------------------------------------------
- Declaration: function NewStr(S : String): PString;
-
- Unit: Objects
-
- Purpose:
- Use NewStr to dynamically a string variable. NewStr is especially useful
- for creating arrays or collections of strings. See listing, below, for an
- example of an array of strings. Always use DisposeStr to dispose a
- PString object created with NewStr.
-
- Sample code:
- var
- AStrArray : Array[0..100] of PString;
- ...
- for I := 0 to 100 do
- begin
- Readln(InFile, AWord);
- AStrArray[I] := NewStr(AWord);
- end;
-
- for I:=0 to 100 do
- Writeln( AStrArray[I]^ );
-
- See: DisposeStr, Chapter 14,"Collections" in the Borland Pascal Developer's
- Guide.
-
-
- NewSubMenu function
- ------------------------------------------------------------
- Declaration: function NewSubMenu( Name: TMenuStr;
- AHelpCtx: Word;
- SubMenu: PMenu;
- Next: PMenuItem) : PMenuItem;
-
- Unit: Menus
-
- Purpose:
- NewSubMenu creates an individual pulldown menu within the menu bar
- initialization. See Chapter 11, "Turbo Vision Tutorial" in the Borland
- Pascal Developer's Guide for examples of menu creation.
- See: NewItem, NewMenu, NewLine
-
-
- ofXXXX constants
- ------------------------------------------------------------
- TView.Options field bit positions
-
- Purpose:
- The ofXXXX constants select options available in all TView-derived
- objects. Setting the bit position to a 1 sets the indicated attribute;
- clearing the bit position to 0 disables the indicated attributes.
-
- Constant Value Usage
- ofSelectable $0001 If this bit is set, then the view can be
- selected with a mouse. While most views are normally
- selectable, this bit gives the option to make the item
- unselectable. An example of an unselectable view is
- TStaticText items.
-
- ofTopSelect $0002 When set, this view will move to the
- topmost view whenever it is selected. This option should
- normally be set only for window objects.
-
- ofFirstClick $0004 When a mouse click is used to select a
- view, the click can be optionally passed to the view
- after it is selected. For example, within a dialog box,
- if you click on a button, you not only wish to set the
- focus to that button, but you probably also want to
- activate the button at the same time.
-
- ofFramed $0008 When set, the view has visible frame drawn
- around it.
-
- ofPreProcess $0010 This option enables views other than the
- focused view to have a chance at processing an event.
- Normally, events are passed down the focus-chain,
- however, events are also sent to any subviews (in
- Z-order) that have this bit set, giving them a chance to
- process the event. See Chapter 13, "More Turbo Vision
- Features" in the Borland Pascal Developer's Guide.
-
- ofPostProcess $0020 When this bit is set, subviews are given a
- chance after the focused view, to process events that
- have not yet cleared.
-
- ofBuffered $0040 Views can optionally store an image of
- themselves in a memory buffer. When the view needs to be
- redrawn on the screen, it can rapidly copy itself from
- the buffer, rather than recreate the drawing on the
- screen. To enable cache buffering of the view's
- displayable image, set the ofBuffered bit to on. The
- buffers are stored in special, disposable memory caches.
- When the memory manager runs out of memory, these cache
- buffers are automatically deleted to free up more memory
- space, and the view's recreate their displayable images
- as they would without the ofBuffered option.
- If you set the ofBuffered option, be sure to call
- the TGroup method's Lock and Unlock to prevent copying of
- the screen image to the display until all of the
- subview's have drawn themselves.
- See also: GetBufMem, FreeMem
-
- ofTileable $0080 Generally, you will want window objects to
- be either tileable or cascadeable so that the desktop can
- automatically rearrange the windows, if desired. If you
- wish to disable this function for a particular view,
- clear this bit position in the Options field. When
- disabled, the view will not move on the screen, even if
- other views become tiled or cascaded. See also:
- TDeskTop.Cascade, TDeskTop.Tile.
-
- ofCenterX $0100 When this bit is set, the insertion of the
- view causes the view to be horizontally centered.
-
- ofCenterY $0200 When this bit is set, a view is centered
- in the vertical direction (especially useful when
- switching between 25 and 43/50 line modes).
-
- ofCentered $0300 Same as setting both ofCenterX and
- ofCenterY: centers the view in both vertical and
- horizontal directions.
-
-
- PChar type
- ------------------------------------------------------------
- Declaration: PChar = ^Char;
-
- Unit: Objects
-
-
- PositionalEvents variable
- ------------------------------------------------------------
- Declaration:
- PositionalEvents: Word = evMouse;
-
- Unit: Views
-
- Purpose:
- You can force events and messages to route as if they are positional
- events by setting PositionalEvents to the event's evXXXX constant. By
- adding your own event classes (by setting the bit patterns) you can create
- broadcast messages that route the same as a positional event.
- See: FocusedEvents, Chapter 13, "More Turbo Vision Features" in the
- Borland Pascal Developer's Guide.
-
-
- PrintStr procedure
- ------------------------------------------------------------
- Declaration: procedure PrintStr(S : String);
-
- Unit: Drivers
-
- Purpose:
- Writes the string S to the screen. You might wish to use this procedure
- in place of the Pascal Write function, since PrintStr calls a DOS function
- directly, thereby eliminating the need to link in the much larger Turbo
- Pascal file I/O library routines.
-
-
- PString type
- ------------------------------------------------------------
- Declaration: PString = ^String;
-
- Unit: Objects
-
-
-
- PtrRec type
- ------------------------------------------------------------
- Declaration: PtrRec = record
- Ofs, Seg : Word;
- end;
-
- Unit: Objects
-
- Purpose:
- Use this type to reference the segment:offset values of a pointer
- variable.
-
-
- RegisterApp procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterApp
-
- Unit: App
-
- Purpose:
- Calls RegisterType to register all objects in the App unit (see below) for
- stream I/O.
- Objects registered by RegisterApp: TBackground, TDeskTop
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal Developer's
- Guide.
-
-
- RegisterColorSel procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterColorSel;
-
- Unit: ColorSel \TP\TVDEMOS\COLORSEL.PAS, ..TPU
-
- Purpose:
- Calls RegisterType to register all objects in the ColorSel unit (see
- below) for stream I/O.
- Objects registered by RegisterColorSel: TColorSelector,
- TMonoSelector, TColorDisplay, TColorGroupList, TColorItemList,
- TColorDialog
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal Developer's
- Guide.
-
-
- RegisterDialogs procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterDialogs;
-
- Unit: Dialogs
-
- Purpose:
- Calls RegisterType to register all objects in the Dialogs unit (see below)
- for stream I/O.
- Objects registered by RegisterDialogs: TDialog, TInputLine, TButton,
- TCluster, TRadioButtons, TCheckBoxes, TListBox, TStaticText, TLabel,
- THistory, TParamText
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal
- Developer's Guide.
-
-
- RegisterEditors procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterEditors;
-
- Unit: Editors, \TP\EDITORS.PAS
-
- Purpose:
- Calls RegisterType to register all objects in the Editors unit for stream
- I/O.
- Objects registered by RegisterEditors: TEditor, TMemo, TFileEditor,
- TIndicator, TFileWindow
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal Developer's
- Guide.
-
-
- RegisterMenus procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterMenus
-
- Unit: Menus
-
- Purpose:
- Calls RegisterType to register all objects in the Menusunit for stream
- I/O.
- Objects registered by RegisterMenus: TMenuBar, TMenuBox, TStatusLine
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal Developer's
- Guide.
-
-
- RegisterObjects procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterObjects
-
- Unit: Objects
-
- Purpose:
- Calls RegisterType to register all objects in the Objectsunit for stream
- I/O.
- Objects registered by RegisterObjects: TCollection, TStringCollection
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal Developer's
- Guide.
-
-
- RegisterStdDlg procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterStdDlg;
-
- Unit: STDDLG.PAS
-
- Purpose:
- Calls RegisterType to register all objects in the StdDlgunit for stream
- I/O.
- Objects registered by RegisterStdDlg: TFileInputLine, TFileCollection,
- TFileList, TFileInfoPane, TFileDialog, TDirCollection, TDirListBox,
- TChDirDialog
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal Developer's
- Guide.
-
-
- Registertype procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterType( var S : TStreamRec );
-
- Unit: Objects
-
- Purpose:
- When writing objects to a stream, you must first register the object type
- with the Stream I/O system. Example usage:
- RegisterType( RCollection );
- registers the TCollection type using its predefined RCollection stream
- registeration record. See Chapter 15, "Streams" in the Borland Pascal
- Developer's Guide, for a complete discussion on the use of stream I/O and
- the RegisterType procedure.
-
-
- RegisterViews procedure
- ------------------------------------------------------------
- Declaration: procedure RegisterViews
-
- Unit: Views
-
- Purpose:
- Calls RegisterType to register all objects in the Viewsunit for stream
- I/O.
- Objects registered by RegisterViews: TView, TFrame, TScrollBar,
- TScroller, TListViewer, TGroup, TWindow
- See: RegisterType, Chapter 15, "Streams" in the Borland Pascal Developer's
- Guide.
-
-